package com.kischang.blog.model;

import javax.persistence.*;
import java.util.Date;

@Entity
public class Topic {
    private int id;
    private String title;
    private String content;
    //发布时间
    private Date date;
    //作者姓名
    private String authorName;
    //回复数
    private int countReview;
    //作者Id
    private User author;
    //对应板块Id
    private TitleMenu titleColumn;
    private long pv;
    //审核状态		0可查看	1禁止		默认0
    private int state;


    @Id
    @GeneratedValue
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Column(nullable = false, length = 50)
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @Column(nullable = false, columnDefinition = "TEXT")
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @ManyToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "uid")
    public User getAuthor() {
        return author;
    }

    public void setAuthor(User author) {
        this.author = author;
    }

    @Column(nullable = false, length = 50)
    public String getAuthorName() {
        return authorName;
    }

    public void setAuthorName(String authorName) {
        this.authorName = authorName;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @ManyToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "mid")
    public TitleMenu getTitleColumn() {
        return titleColumn;
    }

    public void setTitleColumn(TitleMenu titleColumn) {
        this.titleColumn = titleColumn;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public int getCountReview() {
        return countReview;
    }

    public void setCountReview(int countReview) {
        this.countReview = countReview;
    }

    public long getPv() {
        return pv;
    }

    public void setPv(long pv) {
        this.pv = pv;
    }
}
